/*
File:	cepr_org_keepord.do
Date:	Feb 20, 2006
	Feb 10, 2009
	Feb 22, 2011 CEPR ORG Version 1.6
	Jan 8, 2013
	Dec 20, 2013
	Mar 12, 2015, CEPR ORG Version 2.0
	Apr  1, 2015, CEPR ORG Version 2.0.1
	March 1, 2016, CEPR ORG Version 2.1
	Oct 12, 2016, CEPR ORG Version 2.1.1
	Feb 9, 2017, CEPR ORG Version 2.2
	Apr 21, 2017, CEPR ORG Version 2.2.1
	Apr 10, 2018, CEPR ORG Version 2.3
	Mar 22, 2019, CEPR ORG Version 2.4
	Jul 24, 2019, CEPR ORG Version 2.4.1
	Feb 05, 2020, CEPR ORG Version 2.5
	
Desc:	Preserves and orders data extracted and processed from
	the CPS ORG
Note:	See copyright notice at end of program.
*/

capture program drop keepord
program define keepord
*
* piece of program used in both orgnber and orgcpsb below 
*
keep /*idvar*/ year month minsamp hhid hhid2 hrsample hrsersuf hhnum hrlonglk /*
*/ lineno fnlwgt orgwgt lonwgt famwgt /*
demog*/ age female wbho wbhao wbhom wbhaom racehpia racehpi racea forborn citizen /*
*/ prcitshp arrived prinusyr penatvty pemntvty pefntvty vet /*
family*/ married marstat ownchild ch02 ch05 ch35 ch613 ch1417 famrel84 /*
*/ famrel94 famrel relahh hoh79 refper faminc /*
empstat*/ lfstat empl unem nilf selfemp selfinc pubsect pubfed pubst publoc cow1 cow2 /*
*/ unemdur jobloser jobleaver entrant unmem uncov union cert certgov /*
*/ schenrl schhs schcol schft schpt multjob multjobn pdemp1 pdemp2 nmemp1 nmemp2 /*
geog*/ state metro centcity suburb rural cmsacode05 cmsacode14 fipscounty principalcty /*
*/ smsastat05 smsastat14 cbsasz nyc la /*
educ*/ educ educ92 years_educ /*
ind*/ ind_nber ind_2d ind70 ind80 ind03 ind09 ind12 ind14 ind_m03 agric /*
*/ manuf servs /*
occ*/ docc70 docc80 docc03 occ70 occ80 occ03 occ11 occ12 occ_m03 manag83 /*
*/ manag03 /*
hours*/ hourslwa hourslw hourslwm reason79 reason94 absent79 absent94 abpaid uhours /*
*/ uhourse why3579 why3594 ptecon unempt prhrusl hrsvary pehrusl1 pehrusl2 /*
*/ pehruslt peernhro imphrs hrsimptd uhoursi blsimpt/*
wages*/ blsimph blsimpw paidhre weekpay uearnwke uearnwk earnwke peernuot /*
*/ otcrec otcamt wage1 wage2 wage3 w_ln_no wage4 rw rw_ot tc proxy wholine reltoref



 

order /*idvar*/ year month minsamp hhid hhid2 hrsample hrsersuf hhnum hrlonglk /*
*/ lineno fnlwgt orgwgt lonwgt famwgt /*
demog*/ age female wbho wbhao wbhom wbhaom racehpia racehpi racea forborn citizen /*
*/ prcitshp arrived prinusyr penatvty pemntvty pefntvty vet /*
family*/ married marstat ownchild ch02 ch05 ch35 ch613 ch1417 famrel84 /*
*/ famrel94 famrel relahh hoh79 refper faminc /*
empstat*/ lfstat empl unem nilf selfemp selfinc pubsect pubfed pubst publoc cow1 cow2 /*
*/ unemdur jobloser jobleaver entrant unmem uncov union cert certgov /*
*/ schenrl schhs schcol schft schpt multjob multjobn pdemp1 pdemp2 nmemp1 nmemp2 /*
geog*/ state metro centcity suburb rural cmsacode05 cmsacode14 fipscounty principalcty /*
*/ smsastat05 smsastat14 cbsasz nyc la /*
educ*/ educ educ92 years_educ /*
ind*/ ind_nber ind_2d ind70 ind80 ind03 ind09 ind12 ind14 ind_m03 agric /*
*/ manuf servs /*
occ*/ docc70 docc80 docc03 occ70 occ80 occ03 occ11 occ12 occ_m03 manag83 /*
*/ manag03 /*
hours*/ hourslwa hourslw hourslwm reason79 reason94 absent79 absent94 abpaid uhours /*
*/ uhourse why3579 why3594 ptecon unempt prhrusl hrsvary pehrusl1 pehrusl2 /*
*/ pehruslt peernhro imphrs hrsimptd uhoursi blsimpt/*
wages*/ blsimph blsimpw paidhre weekpay uearnwke uearnwk earnwke peernuot /*
*/ otcrec otcamt wage1 wage2 wage3 w_ln_no wage4 rw rw_ot tc proxy wholine reltoref

end

capture program drop sortit
program define sortit
version 7.0
*
local year=year in 1
*
if 1979<=`year' & `year'<=2002 {
sort month state hhid hhnum lineno minsamp age female married
}
if 2003<=`year' & `year'<=2004 {
sort month state hhid hrsample hrsersuf hhnum lineno minsamp age /*
*/ female married
}
if 2005<=`year' & `year'<=2020 {
sort month state hhid hhid2 hrsample hhnum lineno minsamp age /*
*/ female married
}
end

/* 
Copyright 2020 CEPR and John Schmitt

This file is part of the cepr_org_master.do program. This file and all
programs referenced in it are free software. You can redistribute the
program or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
USA.
*/

